package com.idna.wsconsumer.cxf.dynamic;

import org.apache.cxf.endpoint.Client;
import org.apache.cxf.endpoint.dynamic.DynamicClientFactory;
import org.springframework.beans.factory.xml.DocumentLoader;

public class CXFDynamicClient
{
	public static void main(String[] args)
	{
		try
		{
			//String xmlRequest = "<ProveID type=\"Search\"><Authentication><Username>basil.eltom</Username><Password>letmein</Password></Authentication><Person><DateOfBirth>1944-10-13</DateOfBirth><Gender>Male</Gender><Name><Forename>John</Forename><OtherNames>Richard</OtherNames><Surname>Ferrari</Surname></Name><Aliases><Alias><Forename /><OtherNames /><Surname /></Alias></Aliases></Person><Address><SubPremise /><Premise>17</Premise><SubStreet /><Street /><SubLocality /><Locality /><PostTown /><Region /><Postcode>X99LF</Postcode></Address><Option><ERType>Edited</ERType></Option>    <Driving>       <LicenseNumber>FERRA410134JR12345 99</LicenseNumber>    </Driving><Passport><Number>M34045050</Number><Country>GBR</Country><Nationality>GBR</Nationality><ExpiryDate>2010-06-13 </ExpiryDate><MRZLine2>&lt;&lt;06&lt;</MRZLine2><PersonalNumber>&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;06&lt;</PersonalNumber></Passport></ProveID>";
			String xmlRequest = "<NetID type='Search'><Authentication><Username>basil.eltom</Username><Password>letmein</Password></Authentication><IP>145.116.9.22</IP><AcceptableDistance>100</AcceptableDistance><Telephone>+442079092300</Telephone><Email>product.support@192.com</Email><BIN>401130</BIN><CustomerLocation><Address>sw62uz</Address><CountryCode>gbr</CountryCode><AddressSelection /></CustomerLocation><ShipToLocation><Address>120, w93en</Address><CountryCode>gbr</CountryCode><AddressSelection /></ShipToLocation></NetID>";
			DynamicClientFactory dcf = DynamicClientFactory.newInstance();
			//Client client = dcf.createClient("http://xml.192.com/NetID.cfc?wsdl", new QName("NetIDService"), new QName("NetID.cfc"));
			Client client = dcf.createClient("http://xml.192.com/netid.cfc?wsdl");
			Object[] res = client.invoke("search", new String[]{xmlRequest});
			System.out.println(res[0]);
		}
		catch (Exception e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
